package com.mcxx.convert;

import com.mcxx.modules.miniSalvation.family.entity.BankEntity;
import com.mcxx.modules.temporary.order.dto.TmpAuditDTO;
import com.mcxx.modules.temporary.order.dto.TmpOrderDTO;
import com.mcxx.modules.temporary.order.dto.TmpOrderStateVerifyDTO;
import com.mcxx.util.Constant;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;



public class TmpBankInfoConvert {

    public static BankEntity convertToBankEntity(TmpOrderDTO orderStateVerifyDTO, String applyMemberId) {
        BankEntity bankEntity = new BankEntity();
        bankEntity.setId(Constant.getUUID());
        bankEntity.setAreaCode(orderStateVerifyDTO.getAreaCode());
        bankEntity.setFamilyId(orderStateVerifyDTO.getFamilyId());
        bankEntity.setMemberId(applyMemberId);
        bankEntity.setBusinessType(Constant.BusinessCode.LINSHI);
        bankEntity.setStatus(Constant.BankStatus.OK);
        bankEntity.setApIdcard(orderStateVerifyDTO.getIdcard());
        bankEntity.setAgentAccountIdcard(null);
        bankEntity.setIsAgent(Constant.IsAgent.NO);
        LocalDate date = LocalDate.now();
        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        String dateStr = date.format(fmt);
        bankEntity.setCreateTime(dateStr);
        return bankEntity;
    }

}
